
import { Body, Controller, Post } from '@nestjs/common';
import { ApiOperation } from '@nestjs/swagger'
import { CommandBus } from '@nestjs/cqrs';
import { UserCreateDto } from '../dtos/user-create.dto';
import { UserCreateCommand } from '../commands/user-create.command'
@Controller('users')
export class UserCreateController {
  constructor(private readonly commandBus: CommandBus) { }

  @ApiOperation({ summary: "新增用户" })
  @Post()
  createUser(@Body() body: UserCreateDto) {
    return this.commandBus.execute(
      new UserCreateCommand(body)
    );
  }
}
